/*
* @Author: chenggh
* @Date: 2025-06-18
* @Link to Problem : https://oj.haizeix.com/problem/236
*/
#include <iostream>
using namespace std;
int arr[10] = {0};
void print_arr(int d){
	for(int i = 0; i <= d; i++){
		if(i) cout << " ";
		cout << arr[i];
	}cout << endl;
}
void f(int i, int j, int d, int m){
	if(d == m) {
		print_arr(d - 1);
		return;
	}
	for(int k = i; k <= j; k++){
		arr[d] = k;
		f(k + 1, j, d + 1, m);
	}
}
int main(){
	int n, m; cin >> n >> m;
	f(1, n, 0, m);
	return 0;
}